package com.hwd.gmall.list.controller;

import com.hwd.gmall.list.service.SearchService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 搜索业务的控制层
 *
 * @author 黄伟东/Victor
 * @date 2022/4/28 11:04
 */
@RestController
@RequestMapping(value = "/api/search")
public class SearchController {

    @Resource
    private SearchService searchService;

    /**
     * 商品搜索
     *
     * @param searchData 搜索关键词
     * @return java.util.Map<java.lang.String, java.lang.Object>
     */
    @GetMapping
    public Map<String, Object> search(@RequestParam Map<String, String> searchData) {
        return searchService.searchGoods(searchData);
    }
}
